{
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
}
var
	a:array[1..3000] of longint;

procedure sort(i,j:integer);
var
	min,max:integer;
	key:longint;
begin
	if i<j then
	begin
		key:=a[i];
		min:=i;
		max:=j;
		while(i<j) do
		begin
			while(i<j) and (a[j]<key) do dec(j);
			if(i<j)then
			begin
				a[i]:=a[j];
				inc(i);
			end;
			while(i<j) and (a[i]>key) do inc(i);
			if(i<j)then
			begin
				a[j]:=a[i];
				dec(j);
			end;
		end;
		a[i]:=key;
		sort(min,i-1);
		sort(i+1,max);
	end;
end;

var
	n,i:integer;
begin
	read(n);
	for i:=1 to n do
		read(a[i]);
	sort(1,n);
	writeln(a[1],' ',a[2],' ',a[3]);
end.
